package net.xiduth.game.player.dialogues.auto;

import net.xiduth.game.player.dialogues.Dialogue;
import net.xiduth.utils.ShopsHandler;

public class FrostRewards extends Dialogue {

	@Override
	public void start() {
		sendOptionsDialogue("FDP Rewards", "Dragon claws (300 pts.)", "Frost Dragon bones (10 pts.)",
				"Never mind.");
		stage = 2;
	}

	@Override
	public void run(int interfaceId, int componentId) {
		if (stage == -1) {
			sendOptionsDialogue("FDP Rewards", "Dragon claws (300 pts.)", "Frost Dragon bones (10 pts.)",
					"Never mind.");
			stage = 2;

		} else if (stage == 2) {
			if (componentId == OPTION_1) {
				if (player.getfdragonkills() >= 300) {
					player.getBank().addItem(14484, 1, true);
					player.setfdragonkills(player.getfdragonkills()
							- 300);
					player.getInterfaceManager().closeChatBoxInterface();
					player.getInterfaceManager().sendChatBoxInterface(1189);
					player.getPackets().sendItemOnIComponent(1189, 1, 14484, 1);
					player.getPackets().sendIComponentText(1189, 4, "The item has been added to your bank.");
					}else{
					player.getDialogueManager().startDialogue("SimpleMessage","You need 300 points to buy this item." );
					}

			} else if (componentId == OPTION_2) {
				if (player.getfdragonkills() >= 10) {
					player.getBank().addItem(18830, 30, true);
					player.setfdragonkills(player.getfdragonkills()
							- 10);
					player.getInterfaceManager().closeChatBoxInterface();
					player.getInterfaceManager().sendChatBoxInterface(1189);
					player.getPackets().sendItemOnIComponent(1189, 1, 18830, 1);
					player.getPackets().sendIComponentText(1189, 4, "The items have been added to your bank.");
					}else{
					player.getDialogueManager().startDialogue("SimpleMessage","You need 10 points to buy this item." );
					}

			} else if (componentId == OPTION_3) {
				player.getInterfaceManager().closeChatBoxInterface();
				end();
			}

		} else if (stage == 4) {
			if (componentId == OPTION_1) {
				ShopsHandler.openShop(player, 10);
				end();

			} else if (componentId == OPTION_2) {
				ShopsHandler.openShop(player, 11);
				end();

			} else if (componentId == OPTION_3) {
				ShopsHandler.openShop(player, 29);
				end();
			}
		}
	}

	@Override
	public void finish() {

	}

}